package ar.edu.unlam.lyc.utilitarios;

public class Sentencia {

	private String statement;
	
	public Sentencia(String statement){
		this.statement = statement;
	}

	public Sentencia(String statement, String[] parameters){
		this.statement = statement;
		for (int i=0; i<parameters.length; i++){
			this.setParameter(parameters[i]);
		}
	}
	
	public void setParameter(String parameter){
		this.statement = this.statement.replaceFirst("\\?",parameter);
	}
	
	public String toString(){
		if (this.statement.endsWith(":") || this.statement.startsWith(";")){
			return this.statement;			
		}
		return "\t" + this.statement;
	}

	public static void main (String[] args){
		Sentencia ms = new Sentencia("Hola ? ?");
		ms.setParameter("loco");
		ms.setParameter("lindo");
		System.out.println(ms);
	}	
}